﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace MSPToolkitSampleApp
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            InitializeSamplesList();
        }

        void InitializeSamplesList()
        {
            //add new sample pages here
            ContentPanel.DataContext = new List<KeyValuePair<string,Uri>>
            {
                new KeyValuePair<string,Uri>("trial helper sample", new Uri("/UtilitesSamples/TrialHelperSample.xaml", UriKind.Relative))
                , new KeyValuePair<string,Uri>("tile generator sample", new Uri("/UtilitesSamples/TileGeneratorSample.xaml", UriKind.Relative))
                , new KeyValuePair<string,Uri>("image generator sample", new Uri("/UtilitesSamples/ImageGeneratorSample.xaml", UriKind.Relative))
                , new KeyValuePair<string, Uri>("encodings sample", new Uri("/UtilitesSamples/EncodingsSample.xaml", UriKind.Relative))
                , new KeyValuePair<string, Uri>("htmltextbox sample", new Uri("/ControlsSamples/HTMLTextBoxSample.xaml", UriKind.Relative))
                , new KeyValuePair<string, Uri>("htmlviewer sample", new Uri("/ControlsSamples/HTMLViewerSample.xaml", UriKind.Relative))
                , new KeyValuePair<string, Uri>("stringhtmladditions sample", new Uri("/UtilitesSamples/StringHTMLAdditionsSample.xaml", UriKind.Relative))
                , new KeyValuePair<string, Uri>("behaviors sample", new Uri("/UtilitesSamples/BehaviorsSample.xaml", UriKind.Relative))
                //, new KeyValuePair<string,Uri>("PhotoGalery", new Uri("/ControlsSamples/PhotoGallerySamplePage.xaml", UriKind.Relative))
            };
        }

        private void ContentPanel_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ContentPanel.SelectedIndex == -1) return;
            KeyValuePair<string, Uri> item = (KeyValuePair<string,Uri>) ContentPanel.SelectedItem;// as (new {Title="", Page=new Uri("www.contoso.com")}).GetType();
            NavigationService.Navigate(item.Value);
            ContentPanel.SelectedIndex = -1;
        }
    }
}